/* Includes ------------------------------------------------------------------*/
#include "bsp_common.h"
#include "lvgl/lvgl.h"
#include "stdio.h"


/* Private macro -------------------------------------------------------------*/

/* Private typedef -----------------------------------------------------------*/

/* Private variables ---------------------------------------------------------*/

/* Private function prototypes -----------------------------------------------*/

/* Private functions ---------------------------------------------------------*/

/******************************************************************************
 * Function Name  : file_exist
 * Description    : Check if the file exists
 * Input          : path
 * Output         : None
 * Return         : true or false, true if the file exists, false if not
*******************************************************************************/
bool file_exist(string path)
{
    char file_path[256];
    memset(file_path, 0, sizeof(file_path));
    
#if defined(LV_USE_FS_STDIO)
    if (path[0] == '/')
        path++;
    sprintf(file_path, "%s%s", LV_FS_STDIO_PATH, path);
#else
    sprintf(file_path, "%s", path);
#endif
    printf("file_path: %s\n", file_path);
    FILE *fp = fopen(file_path, "r");
    if (fp == NULL)
    {
        return false;
    }
    fclose(fp);
    return true;
}

/************************ (C) COPYRIGHT PURESUN *****END OF FILE***************/
